# coding:utf-8
class Admin::CityChannelsController < AdminController

  set_tab :programs
  set_tab :city_channel, :sub_nav
  before_filter :setup, only: [:index]
  respond_to :html, :json

  def index
  end

  def new
    @city_channel = CityChannel.new mode: 'dtmb'
  end

  def edit
    @city_channel = CityChannel.find params[:id]
  end

  def create
    @city_channel = CityChannel.new(params[:city_channel])
    
    if @city_channel.save
    else
      render :action => :new 
    end
  end

  def update
    @city_channel = CityChannel.find params[:id]
    if @city_channel.update_attributes(params[:city_channel])
    else
      render :action => :edit 
    end
  end

  private

  def setup
    @ways = ["电台节目","目录管理"]
    @left_panel = "admin/programs/left_panel"
  end

end
